/**
 * Author: luoqi
 * Created Date: 2025-11-12 23:23:2
 * Last Modified: 2025-11-13 00:08:27
 * Modified By: luoqi at <**@****>
 * Copyright (c) 2025 <*****>
 * Description:
 */

#include <bsp.h>
#include <uart_port.h>
#include <cli.h>
#include "shell.h"

static void task_shell_hdl(void)
{
    char buf[64];
    int sz = uart_read(UART_PORT1, buf, sizeof(buf));
    if(sz > 0) {
        for(int i = 0; i < sz; i++) {
            cli_exec(buf[i]);
        }
    }

}

int shell_init(void)
{
    return task_add("shell", task_shell_hdl, 1);
}
